/*
 * @Author: wuyuxin
 * @Date: 2022-04-16 10:51:15
 * @LastEditors: wuyuxin
 * @LastEditTime: 2022-04-25 09:37:55
 * @Description:
 */
import YXRequest from '@/service/index'
import { IDataType } from '../type'

enum LoginAPI {
  AccountLogin = '/login',
  LoginUserInfo = '/users/', // 用法: /users/1
  UserMenus = '/role/' // 用法: role/1/menu
}

export function handleLogin(data: any) {
  return YXRequest.post<IDataType>({
    url: LoginAPI.AccountLogin,
    data: data
  })
}

export function getUserInfoById(data: number) {
  return YXRequest.get<IDataType>({
    url: LoginAPI.LoginUserInfo + data
  })
}

export function getMenuListByRoleId(data: number) {
  return YXRequest.get<IDataType>({
    url: LoginAPI.UserMenus + data + '/menu'
  })
}
